<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="java.util.*"%>
<%@ page import="org.jadestudio.dsdown.entity.ManageGamePublishCompany"%> 

<%
	String mode = (String) request.getAttribute("flag");
	List<Map> gameType = (List<Map>) request.getAttribute("gameType");
	Map queryMap = (HashMap)request.getAttribute("gameMap");
	List<java.util.Map> gameDownloadsMap = (List)request.getAttribute("gameDownloadsMap");
	List<java.util.Map> gamePurchaseMap = (List)request.getAttribute("gamePurchaseMap");
	List<java.util.Map> gamePicMap = (List)request.getAttribute("gamePicMap");
	List<java.util.Map> gamePlatFormMap = (List)request.getAttribute("gamePlatform");
	String gamePlatFormIds="";
	String gameLanguage="";
	String ignScore="";
	String famiScore="";
	String[] gameLanguageArr=null;
	String[] ignScoreArr=null;
	String[] famiScoreArr=null;
	String url = "";
	String title = "";
	
	ManageGamePublishCompany manageGamePublishCompany;
	if (mode != null && !mode.equals("")) {
		if (mode.equals("add")) {
			title = "图鉴新增";
			url = "gameManage.do?pm=gameAdd";
		} else if (mode.equals("modify")) {
			title = "图鉴修改";
			url = "gameManage.do?pm=gameModify";
			//平台显示
			gamePlatFormIds=(String)queryMap.get("game_platform_id")!=null?queryMap.get("game_platform_id").toString():"";//平台
		 	//语言显示
		 	gameLanguage=(String)queryMap.get("game_language")!=null?queryMap.get("game_language").toString():"";//语言
			if(!gameLanguage.equals("")){
				gameLanguageArr=gameLanguage.split(",");
			}	 
		 	//IGN评分
		    ignScore=(String)queryMap.get("ign_score")!=null?queryMap.get("ign_score").toString():"";//IGN评分
		    //FAMI通评分
		    famiScore=(String)queryMap.get("fami_score")!=null?queryMap.get("fami_score").toString():"";//fami评分
		    if(!ignScore.equals("")){
		    	ignScoreArr=ignScore.split(",");
		    }
		    if(!famiScore.equals("")){
		    	famiScoreArr=famiScore.split(",");
		    }
		}
	}
%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- webEditor加载 -->
<meta charset="utf-8" />
<style>
form {
	margin: 0;
}

textarea {
	display: block;
	border: 1px #ccc solid;
}

input checkbox{
	border: 1px #ccc solid;
}




#galleria{height:250px;width:600px; background-color:#FFF}
</style>
<script type="text/javascript" src="/resources/scripts/JTimer.js"></script>
<script charset="utf-8" src="/resources/kdweb/kindeditor-min.js"></script>
<script charset="utf-8" src="/resources/kdweb/lang/zh_CN.js"></script>
<script src="/resources/scripts/galleria/galleria-1.2.7.min.js"></script>
<script src="/resources/scripts/galleria/galleria.picasa.min.js"></script>
<script src="/resources/scripts/wbox/jq-wbox-min.js"></script>
<link rel="stylesheet" type="text/css" href="/resources/scripts/wbox/wbox-min.css" />
<script>
var editor;
KindEditor.ready(function(K) {	
	editor = K.create('textarea[name="game_introduction"]', {
		allowFileManager : true,
		allowImageUpload : false,
		allowFlashUpload : false,
		allowFileUpload : false,
		allowMediaUpload : false
	});
});
</script>
<!-- webEditor加载END -->
<!-- autoComplete加载 -->
<script language="javascript"
	src="/resources/scripts/jquery.autocomplete.js">
</script>
<style type="text/css">
.ac_results {
	padding: 0px;
	border: 1px solid black;
	background-color: white;
	overflow: hidden;
	z-index: 99999;
}

.ac_results ul {
	width: 100%;
	list-style-position: outside;
	list-style: none;
	padding: 0;
	margin: 0;
}

.ac_results li {
	margin: 0px;
	padding: 2px 5px;
	cursor: default;
	display: block;
	font: menu;
	font-size: 12px;
	line-height: 16px;
	overflow: hidden;
}

.ac_loading {
	background: white url('indicator.gif') right center no-repeat;
}

.ac_odd {
	background-color: #eee;
}

.ac_over {
	background-color: #CCC;
	color: black;
}
</style>
<!-- autoComplete加载 END-->
<form action="" method="post" name="formObj" id="formObj">
	<input type="hidden" name="game_id" id="game_id" value="${gameMap.game_id}">
	<input type="hidden" name="game_introduction_value" id="game_introduction_value" value="">
	<script type="text/javascript">
	function readyToSubmit() {
		document.getElementById("formObj").action = "<%=url%>";
		var game_introduction_value = editor.html();
		$("#game_introduction_value").val(game_introduction_value);
		//TODO:需要验证下参数
		document.getElementById("formObj").submit();
	}
	function deletePurchaseUrl(obj) {
		$(obj).parent().parent().next().remove();
		$(obj).parent().parent().remove();
	}
	function deleteDownloadUrl(obj) {
		$(obj).parent().parent().next().remove();
		$(obj).parent().parent().remove();
	}
	function deletePicUrl(obj) {
		$(obj).parent().parent().next().remove();
		$(obj).parent().parent().remove();
	}
	
	function addDownloadUrl() {
		var game_download_url_obj = "<tr><input  type='hidden' name='game_downloads_id' value='' size='24' maxlength='100' /><td>+名称&nbsp;<input  type='text' name='game_downloads_name' value='' size='24' maxlength='100' /></td><td>下载地址&nbsp;<input  type='text' name='game_downloads_url' value='' size='60' maxlength='100' /></td><td><input style='border:1px #333 solid' onclick='deleteDownloadUrl(this)'  value='删除' type='button' /></td></tr><tr><td colspan='3'>&nbsp;</td></tr>";
		var game_downloads_urls = $("#game_downloads_urls").html()
				+ game_download_url_obj;
		$("#game_downloads_urls").html(game_downloads_urls);
	}
	
	function addPurchaseUrl() {
		var game_purchase_url_obj = "<tr><input  type='hidden' name='game_purchase_id' value='' size='24' maxlength='100' /><td colspan='4'>+&nbsp;&nbsp;价格&nbsp;<input  type='text' name='game_purchase_price' value='' size='24' maxlength='100' />&nbsp;&nbsp;图片&nbsp;<input  type='text' name='game_purchase_pic_url' value='' size='24' maxlength='100' />&nbsp;&nbsp;商品名&nbsp;<input  type='text' name='game_purchase_title' value='' size='24' maxlength='100' />&nbsp;&nbsp;店铺名&nbsp;<input  type='text' name='game_purchase_store_name' value='' size='24' maxlength='100' />&nbsp;&nbsp;<br/>店铺地址&nbsp;<input  type='text' name='game_purchase_store_url' value='' size='24' maxlength='100' />&nbsp;&nbsp;购买地址&nbsp;<input  type='text' name='game_purchase_url' value='' size='24' maxlength='100' />&nbsp;&nbsp;是否会员添加&nbsp;<input  type='text' name='game_purchase_flag' value='' size='24' maxlength='100' />&nbsp;&nbsp;<input style='border:1px #333 solid' onclick='deletePurchaseUrl(this)'  value='删除' type='button' /></td></tr><tr><td colspan='3'>&nbsp;</td></tr>";
		var game_purchase_urls = $("#game_purchase_urls").html()
				+ game_purchase_url_obj;
		$("#game_purchase_urls").html(game_purchase_urls);
	}
	
	function addPurchaseUrl2(game_purchase_price,game_purchase_pic_url,game_purchase_title,game_purchase_store_name,game_purchase_store_url,game_purchase_url,game_purchase_flag) {
		var game_purchase_url_obj = "<tr><input  type='hidden' name='game_purchase_id' value='' size='24' maxlength='100' /><td colspan='4'>+&nbsp;&nbsp;价格&nbsp;<input  type='text' name='game_purchase_price' value='"+game_purchase_price+"' size='24' maxlength='100' />&nbsp;&nbsp;图片&nbsp;<input  type='text' name='game_purchase_pic_url' value='"+game_purchase_pic_url+"' size='24' maxlength='100' />&nbsp;&nbsp;商品名&nbsp;<input  type='text' name='game_purchase_title' value='"+game_purchase_title+"' size='24' maxlength='100' />&nbsp;&nbsp;店铺名&nbsp;<input  type='text' name='game_purchase_store_name' value='"+game_purchase_store_name+"' size='24' maxlength='100' />&nbsp;&nbsp;<br/>店铺地址&nbsp;<input  type='text' name='game_purchase_store_url' value='"+game_purchase_store_url+"' size='24' maxlength='100' />&nbsp;&nbsp;购买地址&nbsp;<input  type='text' name='game_purchase_url' value='"+game_purchase_url+"' size='24' maxlength='100' />&nbsp;&nbsp;是否会员添加&nbsp;<input  type='text' name='game_purchase_flag' value='"+game_purchase_flag+"' size='24' maxlength='100' />&nbsp;&nbsp;<input style='border:1px #333 solid' onclick='deletePurchaseUrl(this)'  value='删除' type='button' /></td></tr><tr><td colspan='3'>&nbsp;</td></tr>";
		var game_purchase_urls = $("#game_purchase_urls").html()
				+ game_purchase_url_obj;
		$("#game_purchase_urls").html(game_purchase_urls);
	}
	
	function addPicUrl() {
		var game_download_url_obj = "<tr><input  type='hidden' name='game_pic_id' value='' size='24' maxlength='100' /><td>+图片地址&nbsp;<input  type='text' name='game_pic_url' value='' size='60' maxlength='100' style='cursor:pointer' onclick='openUpload(this)' /></td><td>&nbsp;<input style='border:1px #333 solid' onclick='deletePicUrl(this)'  value='删除' type='button' /></td></tr><tr><td colspan='3'>&nbsp;</td></tr>";
		var game_downloads_urls = $("#game_pic_urls").html()
				+ game_download_url_obj;
		$("#game_pic_urls").html(game_downloads_urls);
	}
	
	/****************图片上传组件**************/
	function openUpload(obj){
	 	 var windowStatus = "dialogWidth:400px; dialogHeight:360px; center:yes; resizable:no; scroll:no; status:no; help:no; ";
	 	 var url = "common.do?pm=gotoUpload";
	 	 var returnValue = window.showModalDialog(url,"",windowStatus);
	 	 if(returnValue!=undefined){
	 		 obj.value=returnValue;
	 	 }
	}
	/*****************图片上传组件END****************/
	       
	var data;//图片展示数组
	$(document).ready(
			function() {
				/***************autocomplete加载	******************/
				$("#publish_company_name").autocomplete(
						"gameManage.do?pm=getGamePublishCompanyByName", {
							minChars : 1,
							max : 20,
							autoFill : false,
							scroll : true,
							mustMatch : false,
							matchContains : true,
							scrollHeight : 220,
							dataType : 'json',
							matchSubset : false,
							cacheLength : 0,
							parse : function(data) {
								if (data != "") {
									data = eval(data);//去空格;
							var rows = [];
							for ( var i = 0; i < data.length; i++) {
								rows[i] = {
									data : data[i].name, //下拉框显示数据格式   
									value : data[i].id, //选定后实际数据格式   
									result : data[i].name
								//选定后输入框显示数据格式   
								};
							}
							return rows;
						}
					},
					formatItem : function(data, i, total) {
						return data;
					}
	
						}).result(function(event, item, obj1) {
					if (item == "" || item == "SESSION丢失" || item == "不存在的数据") {
						$("#publish_company_id").val("");
						$("#publish_company_name").val("");
					} else {
						$("#publish_company_id").val(obj1);
					}
	
				});
				
				
				$("#dev_company").autocomplete(
						"gameManage.do?pm=getGamePublishCompanyByName", {
							minChars : 1,
							max : 20,
							autoFill : false,
							scroll : true,
							mustMatch : false,
							matchContains : true,
							scrollHeight : 220,
							dataType : 'json',
							matchSubset : false,
							cacheLength : 0,
							parse : function(data) {
								if (data != "") {
									data = eval(data);//去空格;
							var rows = [];
							for ( var i = 0; i < data.length; i++) {
								rows[i] = {
									data : data[i].name, //下拉框显示数据格式   
									value : data[i].id, //选定后实际数据格式   
									result : data[i].name
								//选定后输入框显示数据格式   
								};
							}
							return rows;
						}
					},
					formatItem : function(data, i, total) {
						return data;
					}
	
						}).result(function(event, item, obj1) {
					if (item == "" || item == "SESSION丢失" || item == "不存在的数据") {
						//$("#publish_company_id").val("");
						$("#dev_company").val("");
					} else {
						//$("#publish_company_id").val(obj1);
					}
	
				});
				/***************autocomplete加载END	******************/
				/***************图片展示加载****************/
				 data = [
					 	<%if(gamePicMap!=null){
						   		if(gamePicMap.size()>0){
						   			for(int t=0;t<gamePicMap.size();t++){
						   %>
							{
								image: '<%=gamePicMap.get(t).get("game_pic_url")!=null?gamePicMap.get(t).get("game_pic_url"):""%>'
							},
						<%}}} %>
						];
					Galleria.loadTheme('/resources/scripts/galleria/galleria.classic.min.js');
					Galleria.run('#galleria', { dataSource: data });
				/***************图片展示加载END****************/
				 $("#addPurchaseUrlByTaobaoApi").wBox({title:"淘宝接入",opacity:0,target:"#taobaoApiList"});
	
});

			
</script>
	<div class="content-box-header">
		<h3><%=title%></h3>
		<div class="clear"></div>
	</div>
	<div class="content-box-content">
		<table>
			<thead>
				<tr>
					<td style="width: 70px">
						游戏名称 &nbsp;
						<span style="color: red">*</span>
					</td>
					<td style="width: 280px">
						<input checkSelf="true" type="text" name="simplified_chinese_name"
							value="${gameMap.simplified_chinese_name}" size="24" maxlength="50">
					</td>
					<td>
						&nbsp;
					</td>
					<td checkSelfNotice="true"></td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						繁体名称 &nbsp;
					</td>
					<td style="width: 280px">
						<input type="text" name="traditional_chinese_name" value="${gameMap.traditional_chinese_name}"
							size="24" maxlength="50">
					</td>
					<td>
						&nbsp;
					</td>
					<td></td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						英文名称 &nbsp;
					</td>
					<td style="width: 280px">
						<input type="text" name="english_name" value="${gameMap.english_name}" size="24"
							maxlength="80">
					</td>
					<td>
						&nbsp;
					</td>
					<td></td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						日文名称 &nbsp;
					</td>
					<td style="width: 280px">
						<input type="text" name="japanese_name" value="${gameMap.japanese_name}" size="24"
							maxlength="50">
					</td>
					<td>
						&nbsp;
					</td>
					<td></td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						游戏TAG&nbsp;
					</td>
					<td style="width: 280px">
						<input type="text" name="game_tag" value="${gameMap.game_tag}" size="60"
							maxlength="100">
					</td>
					<td>
						&nbsp;
					</td>
					<td></td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td>
						游戏平台&nbsp;
					</td>
					<td colspan="2">	
							<%
								if(gamePlatFormMap.size()>0){
									for (int t = 0; t < gamePlatFormMap.size(); t++) {
							%>
									<input type="checkbox" name="game_platform_id" <% if(gamePlatFormIds.indexOf((String)gamePlatFormMap.get(t).get("game_platform_id"))!=-1) {%><%="checked" %><%} %> value="<%=gamePlatFormMap.get(t).get("game_platform_id")%>"><%=gamePlatFormMap.get(t).get("game_platform_name")%>&nbsp;&nbsp;
							<%
									}
								}
							%>
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td>
						游戏类型&nbsp;
					</td>
					<td>
						<select name="game_type_id">
							<%
							if(gameType.size()>0){
								for (int t = 0; t < gameType.size(); t++) {
							%>
							<option <%= queryMap!=null?(queryMap.get("game_type_id")!=null?(queryMap.get("game_type_id").equals(gameType.get(t).get("game_type_id"))?"selected":""):""):""  %> value="<%=gameType.get(t).get("game_type_id")%>"><%=gameType.get(t).get("game_type_name")%>(<%=gameType.get(t).get("game_type")%>)</option>
							<%
								}
							}
							%>
						</select>
					</td>
					<td>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						游戏大图(186*235)&nbsp;
					</td>
					<td colspan="3">
						<input type="text" name="game_img_normal" value="${gameMap.game_img_normal}"  style='cursor:pointer'   onclick="openUpload(this)" size="60"
							maxlength="200">
						&nbsp;
						&nbsp;
						<input style="border: 1px #333 solid" value="查看" type="button" />
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						游戏小图(160*100)&nbsp;
					</td>
					<td colspan="3">
						<input type="text" name="game_img_small" value="${gameMap.game_img_small}"  style='cursor:pointer'  onclick="openUpload(this)" value="" size="60"
							maxlength="200">
						&nbsp;
						&nbsp;
						<input style="border: 1px #333 solid" value="查看" type="button" />
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						开发商&nbsp;
					</td>
					<td style="width: 280px">
						<input type="text" name="dev_company" id="dev_company"  value="${gameMap.dev_company}" size="24"
							maxlength="50">
					</td>
					<td>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						发行商&nbsp;
						<span style="color: red">*</span>
					</td>
					<td colspan="2">
						<input type="text" checkSelf="true" name="publish_company_name"
							id="publish_company_name" value="${gameMap.game_publish_company}" size="24" maxlength="32">
						&nbsp;&nbsp;
						<input type="hidden" style="display: none"
							name="publish_company_id" id="publish_company_id" value="${gameMap.publish_company_id}"
							size="24" maxlength="32" />
						<input style="border: 1px #333 solid"
							onclick="OpenNewWindow('gameManage.do?pm=gotoPublishCompanyAdd2',300,300)"
							value="新建" type="button">
					</td>
					<td checkSelfNotice="true"></td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						游戏语言&nbsp; 
					</td>
					<td style="width: 280px">
						<!-- <input type="text" name="game_language" value="${gameMap.game_language}" size="24" maxlength="50"> -->
						<input type="checkbox" name="game_language_jpn" <%=!gameLanguage.equals("")?(gameLanguage.indexOf("jpn")!=-1?"checked":""):"" %>/>日语&nbsp;&nbsp;
						<input type="checkbox" name="game_language_eng" <%=!gameLanguage.equals("")?(gameLanguage.indexOf("eng")!=-1?"checked":""):"" %>/>英语&nbsp;&nbsp;
						<input type="checkbox" name="game_language_scn" <%=!gameLanguage.equals("")?(gameLanguage.indexOf("chs")!=-1?"checked":""):"" %>/>简体中文&nbsp;&nbsp;
						<input type="checkbox" name="game_language_tcn" <%=!gameLanguage.equals("")?(gameLanguage.indexOf("cht")!=-1?"checked":""):"" %>/>繁体中文&nbsp;&nbsp;
						<input type="checkbox" name="game_language_kon" <%=!gameLanguage.equals("")?(gameLanguage.indexOf("kon")!=-1?"checked":""):"" %>/>韩文&nbsp;&nbsp;
						<input type="checkbox" name="game_language_etc" <%=!gameLanguage.equals("")?(gameLanguage.indexOf("oth")!=-1?"checked":""):"" %>/>其他&nbsp;&nbsp;
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						发行日期&nbsp;
						<span style="color: red">*</span>
					</td>
					<td style="width: 280px">
						<input type="text" name="publish_date"  checkSelf="true" value="${gameMap.publish_date}" size="24" onclick="JTC.setday(this)" readonly 
							maxlength="24">
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
					<td checkSelfNotice="true">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						Fami通评分&nbsp;
					</td>
					<td style="width: 280px">
						<input checkSelf="true" type="text" name="fami_score" value="<%=famiScoreArr!=null?famiScoreArr[0]:"" %>" size="2" maxlength="2">
						<input checkSelf="true" type="text" name="fami_score" value="<%=famiScoreArr!=null?famiScoreArr[1]:"" %>" size="2" maxlength="2">
						<input checkSelf="true" type="text" name="fami_score" value="<%=famiScoreArr!=null?famiScoreArr[2]:"" %>" size="2" maxlength="2">
						<input checkSelf="true" type="text" name="fami_score" value="<%=famiScoreArr!=null?famiScoreArr[3]:"" %>" size="2" maxlength="2">
					</td>
					<td>
						&nbsp;
					</td>
					<td checkSelfNotice="true">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<script type="text/javascript">
						function checkSum(obj){
							if(obj.value==''){
								obj.value=0;
							}
							var score1=document.getElementsByName("ign_score")[1].value!=''?document.getElementsByName("ign_score")[1].value:0;
							var score2=document.getElementsByName("ign_score")[2].value!=''?document.getElementsByName("ign_score")[2].value:0;
							var score3=document.getElementsByName("ign_score")[3].value!=''?document.getElementsByName("ign_score")[3].value:0;
							var score4=document.getElementsByName("ign_score")[4].value!=''?document.getElementsByName("ign_score")[4].value:0;
							var score5=document.getElementsByName("ign_score")[5].value!=''?document.getElementsByName("ign_score")[5].value:0;
							document.getElementsByName("ign_score")[0].value=parseInt(score1)+parseInt(score2)+parseInt(score3)+parseInt(score4)+parseInt(score5);
						}
					</script>
					<td style="width: 70px">
						IGN评分&nbsp;
					</td>
					<td style="width: 280px">
						<input checkSelf="true" readonly="readonly" type="text" name="ign_score" value="<%=ignScoreArr!=null?ignScoreArr[0]:"" %>" size="2" maxlength="2">
						<input checkSelf="true" onblur="checkSum(this)" type="text" name="ign_score" value="<%=ignScoreArr!=null?ignScoreArr[1]:"" %>" size="2" maxlength="2">
						<input checkSelf="true" type="text" onblur="checkSum(this)"  name="ign_score" value="<%=ignScoreArr!=null?ignScoreArr[2]:"" %>" size="2" maxlength="2">
						<input checkSelf="true" type="text" onblur="checkSum(this)"  name="ign_score" value="<%=ignScoreArr!=null?ignScoreArr[3]:"" %>" size="2" maxlength="2">
						<input checkSelf="true" type="text" onblur="checkSum(this)"  name="ign_score" value="<%=ignScoreArr!=null?ignScoreArr[4]:"" %>" size="2" maxlength="2">
						<input checkSelf="true" type="text" onblur="checkSum(this)"  name="ign_score" value="<%=ignScoreArr!=null?ignScoreArr[5]:"" %>" size="2" maxlength="2">
						&nbsp;总分/表现力/画面/音效/可玩性/耐玩度
					</td>
					<td>
						&nbsp;
					</td>
					<td checkSelfNotice="true">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						游戏售价&nbsp;
					</td>
					<td style="width: 280px">
						<input type="text" name="game_price" value="${gameMap.game_price}" size="24"
							maxlength="20">
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="4">
						<textarea name="game_introduction" id="game_introduction" style="width: 700px; height: 500px; visibility: hidden;" >${gameMap.game_introduction}</textarea>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						是否开启下载 &nbsp;
					</td>
					<td style="width: 280px">
						<select type="text" name="game_downloads_enable">
							<option value="1" ${gameMap.game_downloads_enable eq "1" ? "selected" : ""}> 
								是
							</option>
							<option value="0" ${gameMap.game_downloads_enable eq "0" ? "selected" : ""}>
								否
							</option>
						</select>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						下载地址&nbsp;
					</td>
					<td style="width: 280px" colspan="2">
						&nbsp;
						<input style="border: 1px #333 solid" onclick="addDownloadUrl()"
							value="新增" type="button">&nbsp;&nbsp;<span style='color:red'>先新增好再逐个赋值，不要新增一个赋值一个，不然会有问题！</span>
					</td>
					<td>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>

				<!--新增下载地址-->
				<tr>
					<td colspan="4">
						<table id="game_downloads_urls">
						   <%if(gameDownloadsMap!=null){
						   		if(gameDownloadsMap.size()>0){
						   			for(int t=0;t<gameDownloadsMap.size();t++){
						   %>
						   	   
							   <tr><input  type='hidden' name='game_downloads_id' value='<%=gameDownloadsMap.get(t).get("game_downloads_id")!=null?gameDownloadsMap.get(t).get("game_downloads_id"):""%>' size='24' maxlength='100' /><td>+名称&nbsp;<input  type='text' name='game_downloads_name' value='<%=gameDownloadsMap.get(t).get("game_downloads_name")!=null?gameDownloadsMap.get(t).get("game_downloads_name"):""%>' size='24' maxlength='100' /></td><td>下载地址&nbsp;<input  type='text' name='game_downloads_url' value='<%=gameDownloadsMap.get(t).get("game_downloads_url")!=null?gameDownloadsMap.get(t).get("game_downloads_url"):""%>' size='60' maxlength='100' /></td><td><input style='border:1px #333 solid' onclick='deleteDownloadUrl(this)'  value='删除' type='button' /></td></tr><tr><td colspan='3'>&nbsp;</td></tr>  
							<%}}} %>
						</table>
					</td>
				</tr>
				<!--新增下载地址END-->
				<tr>
					<td style="width: 70px">
						是否开启购买 &nbsp;
					</td>
					<td style="width: 280px">
						<select type="text" name="game_purchase_enable">
							<option value="1" ${gameMap.game_purchase_enable eq "1" ? "selected" : ""}>
								是
							</option>
							<option value="0" ${gameMap.game_purchase_enable eq "0" ? "selected" : ""}>
								否
							</option>
						</select>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="4">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						购买地址&nbsp;
					</td>
					<td style="width: 280px" colspan="3">
						&nbsp;
						<input style="border: 1px #333 solid" onclick="addPurchaseUrl()"
							value="新增" type="button">
						&nbsp;	
						<input style="border: 1px #333 solid" id="addPurchaseUrlByTaobaoApi" value="淘宝API接入" type="button" />&nbsp;&nbsp;<span style='color:red'>先新增好再逐个赋值，不要新增一个赋值一个，不然会有问题！</span>
					</td>
					<td>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>

				<!--新增购买地址-->
				<tr>
					<td colspan="4">
						<table id="game_purchase_urls">
						 <%if(gamePurchaseMap!=null){
						   		if(gamePurchaseMap.size()>0){
						   			for(int t=0;t<gamePurchaseMap.size();t++){
						   %> 
							  <tr>
							  	<input  type='hidden' name='game_purchase_id' value='<%=gamePurchaseMap.get(t).get("game_purchase_id")!=null?gamePurchaseMap.get(t).get("game_purchase_id"):""%>' size='24' maxlength='100' />
							  	<td colspan='4'>+&nbsp;&nbsp;价格&nbsp;<input  type='text' name='game_purchase_price' value='<%=gamePurchaseMap.get(t).get("game_purchase_price")!=null?gamePurchaseMap.get(t).get("game_purchase_price"):""%>' size='24' maxlength='100' />&nbsp;&nbsp;图片&nbsp;
							  	<input  type='text' name='game_purchase_pic_url' value='<%=gamePurchaseMap.get(t).get("game_purchase_pic_url")!=null?gamePurchaseMap.get(t).get("game_purchase_pic_url"):""%>' size='24' maxlength='100' />&nbsp;&nbsp;商品名&nbsp;
							  	<input  type='text' name='game_purchase_title' value='<%=gamePurchaseMap.get(t).get("game_purchase_title")!=null?gamePurchaseMap.get(t).get("game_purchase_title"):""%>' size='24' maxlength='100' />&nbsp;&nbsp;店铺名&nbsp;
							  	<input  type='text' name='game_purchase_store_name' value='<%=gamePurchaseMap.get(t).get("game_purchase_store_name")!=null?gamePurchaseMap.get(t).get("game_purchase_store_name"):""%>' size='24' maxlength='100' />&nbsp;&nbsp;<br/>店铺地址&nbsp;
							  	<input  type='text' name='game_purchase_store_url' value='<%=gamePurchaseMap.get(t).get("game_purchase_store_url")!=null?gamePurchaseMap.get(t).get("game_purchase_store_url"):""%>' size='24' maxlength='100' />&nbsp;&nbsp;购买地址&nbsp;
							  	<input  type='text' name='game_purchase_url' value='<%=gamePurchaseMap.get(t).get("game_purchase_url")!=null?gamePurchaseMap.get(t).get("game_purchase_url"):""%>' size='24' maxlength='100' />&nbsp;&nbsp;是否会员添加&nbsp;
							  	<input  type='text' name='game_purchase_flag' value='<%=gamePurchaseMap.get(t).get("game_purchase_flag")!=null?gamePurchaseMap.get(t).get("game_purchase_flag"):""%>' size='24' maxlength='100' />&nbsp;&nbsp;
							  	<input style='border:1px #333 solid' onclick='deletePurchaseUrl(this)'  value='删除' type='button' /></td>
							  </tr>
							  <tr><td colspan='3'>&nbsp;</td></tr>  
							<%}}} %>
						</table>
					</td>
				</tr>
				<!--新增购买地址END-->
				<tr>
					<td colspan="4">
						<table>
							  <div id="galleria"></div>
						</table>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						游戏图片上传&nbsp;
					</td>
					<td style="width: 280px" colspan="2">
						&nbsp;
						<input style="border: 1px #333 solid" onclick="addPicUrl()"
							value="新增" type="button">&nbsp;&nbsp;<span style='color:red'>先新增好再逐个赋值，不要新增一个赋值一个，不然会有问题！</span>
					</td>
					<td>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
				</tr>

				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<!--新增图片上传地址-->
				<tr>
					<td colspan="4">
						<table id="game_pic_urls">
						<%if(gamePicMap!=null){
						   		if(gamePicMap.size()>0){
						   			for(int t=0;t<gamePicMap.size();t++){
						   %>
							<tr><input  type='hidden' name='game_pic_id' value='<%=gamePicMap.get(t).get("game_pic_id")!=null?gamePicMap.get(t).get("game_pic_id"):""%>' size='24' maxlength='100' /><td>+图片地址&nbsp;<input  type='text' name='game_pic_url' value='<%=gamePicMap.get(t).get("game_pic_url")!=null?gamePicMap.get(t).get("game_pic_url"):""%>' size='60' maxlength='100' style='cursor:pointer' onclick='openUpload(this)' /></td><td>&nbsp;<input style='border:1px #333 solid' onclick='deletePicUrl(this)'  value='删除' type='button' /></td></tr><tr><td colspan='3'>&nbsp;</td></tr>
						<%}}} %>
						</table>
					</td>
				</tr>
				<!--新增图片上传地址END-->
				<tr>
					<td style="width: 70px">
						游戏索引字母&nbsp;
					</td>
					<td style="width: 280px">
						<input type="text" name="game_search_index" value="${gameMap.game_search_index}" size="4"
							maxlength="4">
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						是否开启&nbsp;
					</td>
					<td style="width: 280px">
						<select  name="game_enable">
							<option value="1" ${gameMap.game_enable eq "1" ? "selected" : ""}>
								是
							</option>
							<option value="0" ${gameMap.game_enable eq "0" ? "selected" : ""}>
								否
							</option>
						</select>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						是否跳转&nbsp;
					</td>
					<td style="width: 280px" colspan="3">
						<select type="text" name="game_is_redirect">
							<option value="0" ${gameMap.game_is_redirect eq "0" ? "selected" : ""}>
								否
							</option>
							<option value="1" ${gameMap.game_is_redirect eq "1" ? "selected" : ""}>
								是
							</option>
						</select>
						&nbsp;&nbsp;&nbsp;跳转地址&nbsp;&nbsp;
						<input type="text" name="game_redirect_url" value="${gameMap.game_redirect_url}" size="60"
							maxlength="100">
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="width: 70px">
						是否置顶 &nbsp;
					</td>
					<td style="width: 280px">
						<select type="text" name="game_position_top">
							<option value="0" ${gameMap.game_position_top eq "0" ? "selected" : ""}>
								否
							</option>
							<option value="1" ${gameMap.game_position_top eq "1" ? "selected" : ""}>
								是
							</option>
						</select>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td style="text-align: right">
						<input style="border: solid 1px #CCC; width: 100px;" onmousemove=(this.style.background='#57a000') onmouseout=(this.style.background='#FFF') type="button" onclick="readyToSubmit()" value="提交" />
					</td>
					<td style="text-align: center">
						<input style="border: solid 1px #CCC; width: 100px;" onmousemove=(this.style.background='#57a000') onmouseout=(this.style.background='#FFF') onclick="location.href='gameManage.do?pm=gotoGameList'" type="button" value="后退" />
					</td>
					<td colspan="2"></td>
				</tr>
			</thead>
		</table>
		
		
		
		<!-- 淘宝展示层 -->
		 <div id="taobaoApiList" style="display:none;width:500px;height:500px">
		   <div><span>搜索条件&nbsp;<select id="taobaoApiList_select" name="taobaoApiList_select">
			   <option value=0>价格从高到低</option>
			   <option value=1>价格从低到高</option>
			   <option value=2>信用等级从高到低</option>
			   <option value=3>佣金比率从高到低</option>
			   <option value=4>佣金比率从低到高</option>
			   <option value=5 selected>月推广量成高到低</option>
			   <option value=6>月推广量从低到高</option>
			   <option value=7>总支出佣金从高到低</option>
			   <option value=8>总支出佣金从低到高</option>
			   <option value=9>商品下架时间从高到低</option>
			   <option value=10>商品下架时间从低到高</option>
			   </select>
			   </span>
			   <span>开始价格<input type="text" id="taobaoApiList_startPrice" size="5" maxlength="5"/></span>
			   <span>结束价格<input type="text" id="taobaoApiList_endPrice" size="5" maxlength="5"/></span>
		   </div>
		   <div style="margin-top:4px"></div>
		   <div><span>搜索名称&nbsp;<input name="searchTaoBaoName"  type=text /></span><span style="color: red">&nbsp;&nbsp;如需起止价格条件必须都要填写</span></div>
		   <div style="margin-top:4px"></div>
		   <div align="right" style='margin-bottom:6px'><input id="taobaoApiList_search" type=button onclick="searchTaoBaoInfo()" value="搜索" /></div>
		   <div id=taobaoApiList_content style='border:solid 1px #CCC;overflow-y:scroll; height: 420px;' ></div>
		   		   
		 </div>
		 
	</div>
</form>

<script type="text/javascript">

//点击淘宝结果触发
function passParam(obj){
	var tbElement=$(obj).parent().parent().parent().parent();
	var pic_url=$(tbElement).find("td[id='dd_pic_url']").attr("pic_url");//图片地址
	var dd_price=$(tbElement).find("span[id='dd_price']").html();//价格
	var dd_title=$(tbElement).find("span[id='dd_title']").html();//商品名称
	var dd_nick=$(tbElement).find("span[id='dd_nick']").html();//店名
	var shop_click_url=$(tbElement).find("a[id='shop_click_url']").attr("shop_click_url");//商铺地址
	var click_url=$(tbElement).find("a[id='click_url']").attr("click_url");//商品地址
	
	//alert(pic_url);
	//alert(dd_price);
	//alert(dd_title);
	//alert(dd_nick);
	//alert(shop_click_url);
	//alert(click_url);
	addPurchaseUrl2(dd_price,pic_url,dd_title,dd_nick,shop_click_url,shop_click_url,'0');
	
}

//淘宝列表	
function searchTaoBaoInfo(){
	//alert($('#taobaoApiList_select').val());
	//alert(document.getElementsByName('searchTaoBaoName')[0].value);
	var taobaoApiList_content_obj = this.taobaoApiList_content[1];
	if(this.searchTaoBaoName.value!="" && this.searchTaoBaoName.value!=undefined){
		var reqUrl="<%=request.getContextPath()%>/jadestudio/common.do?pm=getGameFromTaoBao&taobaoApiList_select="+this.taobaoApiList_select.value+"&taobaoApiList_searchName="+this.searchTaoBaoName.value+"&taobaoApiList_startPrice="+this.taobaoApiList_startPrice.value+"&taobaoApiList_endPrice="+this.taobaoApiList_endPrice.value;
		$.ajax({
           type: "post",
           dataType: "json",
           url: encodeURI(encodeURI(reqUrl)),
           data: null,
           complete :function(){},
           success: function(msg){ 
           		if(msg.isOK=="0"){
           			alert(msg.msg);
           		}else{
           			taobaoApiList_content_obj.innerHTML="";
           			var items=msg.taobaoke_items_get_response.taobaoke_items.taobaoke_item;
           			var ct="<table>";
           			for(var t=0;t<items.length;t++){
							ct+="<table align=center style='margin-top:8px;border-bottom:solid 1px #000'>"
							ct+="<tr><td rowspan='8' width='200' height='200' id='dd_pic_url' pic_url='"+items[t].pic_url+"' style='background-image:url(\""+items[t].pic_url+"\");width:200px;height:200px;background-repeat:no-repeat; background-size:contain;'></td>"
							ct+="<td>价格:<span id='dd_price'>"+items[t].price	+"</span></td></tr>"
							ct+="<tr><td>商品名称:<span id='dd_title'>"+items[t].title	+"</span></td></tr>"
							ct+="<tr><td>归属地:<span id='dd_item_location'>"+items[t].item_location	+"</span></td></tr>"
							ct+="<tr><td >店面名称:<span id='dd_nick'>"+items[t].nick	+"</span></td></tr>"
							ct+="<tr><td >佣金量:"+items[t].commission	+"</td></tr>"
							ct+="<tr><td >月销量:"+items[t].volume	+"</td></tr>"
							ct+="<tr><td >推广量:"+items[t].commission_num	+"</td></tr>"
							ct+="<tr><td height='21' align='right'>店面地址:<a id='shop_click_url' shop_click_url='"+items[t].shop_click_url+"' style='cursor:pointer' onclick=window.open('"+items[t].shop_click_url+"')>进入</a>&nbsp;商品地址:<a style='cursor:pointer' id='click_url' click_url='"+items[t].click_url+"' onclick=window.open('"+items[t].click_url+"')>进入</a>&nbsp;<input type='button' onclick='passParam(this)' value='加入'/></td></tr>"
							ct+="</table>"
           			}
           			ct+="</table>";
           			taobaoApiList_content_obj.innerHTML=taobaoApiList_content_obj.innerHTML+ct;
           		}
           }
       });
	}else{
		alert('请输入商品名称');
	}
}	
</script>
